<?php
function show3DuAn1dong($where,$limit,$Mark,$phantrang)
{
$stt=0;
if($phantrang=="timkiem"){
  $sql1 = @mysql_query("select * from duan $where order by SapXep asc, IDDuAn desc limit $limit");
  $error='Không tìm thấy dự án nào với từ khóa của bạn !';  
}else{
if($phantrang=="yes"){
    $url=stripUnicode($TenDanhMuc);
    $url=ereg_replace('[[:space:]]+', '-', trim($url));
$sqlll = @mysql_query("select * from duan $where order by SapXep asc, IDDuAn desc");
$sotin=$limit;
$totalpage=round((@mysql_num_rows($sqlll)/$sotin),0);
$linkss="Danh-Muc-".$_GET['MaDanhMuc']."-$url.html?Trang=%s";
include("includes/PhanTrang.php");
$PhanTrang=phantrang($_GET['page'], $totalpage, $linkss, $show);
$sql1 = @mysql_query("select * from duan $where order by SapXep asc, IDDuAn desc limit $page, $page1");
}else{
$sql1 = @mysql_query("select * from duan $where order by SapXep asc, IDDuAn desc limit $limit");    
}
$error='Chưa có dự án nào trong mục này !'; 
}
if(mysql_num_rows($sql1)==0){
    echo '<div align="center" style="text-align: center;color: red;font-weight: bold;"><br/><br/><br/>'.$error.'<br/><br/><br/></div>		';
}
while ($rows1 = @mysql_fetch_array($sql1))
{   $stt=$stt+1;
    $url=stripUnicode($rows1['TenDuAn']);
    $url=ereg_replace('[[:space:]]+', '-', trim($url));
    if($rows1['MoTa']==""){
        $NoiDung=''.substr(strip_tags($rows1['NoiDung']),0,400).'';
        $NoiDung=substr($NoiDung, 0, strrpos($NoiDung, ' ')).'...';
    }else{
        $NoiDung=$rows1['MoTa'];
    }
    if($stt%4==0||$stt==1){
        $style='style="margin-left:0"';
         
    }else{
        $style='';
    }
   echo ' <div class="list-rands-over mTop20" '.$style.'>
<div class="list-rands">
<div class="box-frame-center">
<div class="v6ItemHotImg v7Relative" lang="'.$rows1['IDDuAn'].'">
<div style="display: none;" class="v6ItemHotHover hidden" id="itemHotMoreDetail'.$rows1['IDDuAn'].'">
<a class="v6ImageHover" href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html">
<div class="v6ItemHotHoverText" align="center"></div>
<div class="v6ItemHotHoverTextT">
'.$rows1['DiaChi'].'
</div>
</a>
 
</div>
<a href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html">
<div class="v7price_promotion fixPNG">'.$Mark.'<span></span></div>
<img alt="'.$rows1['TenDuAn'].' - Ch? '.$rows1['Gia'].'" src="'.$rows1['LoGo'].'" height="290" width="290">
</a>
<div class="v7InfoType">
<div class="c"></div>
</div>
</div> 
<div class="v6ContentHot">
<div class="titledeals2" align="left">
<a href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html" title="Xem chi ti?t deal">'.$rows1['TenDuAn'].'</a> 						</div>
<div class="v7bnew f12" style="height: 50px;padding: 10px;overflow:hidden;text-align:justify">'.$NoiDung.'</div>
</div>
<div class="v6TopBorder fixPNG">
<div class="fl v7prices mTop3">
<div class="v7PromotionBigSold">'.$rows1['Gia'].'<span></span></div>

</div>
 
<a href="'.$link.'Du-An-'.$rows1['IDDuAn'].'-'.$url.'.html" class="v7view fr fixPNG mTop20"><img src="images/blank.gif" height="30" width="61"></a>
<div class="c"></div>
</div>
</div>
</div>
</div>'; 
}
if($phantrang=="yes"){
echo '<table align=center class=rowtable2 cellpadding=5 cellspacing=1 border=0 width="100%"><tr><td align=center >'.$PhanTrang.'</td></tr></table>';
}
}
function check_email($Email) {
    if (strlen($Email) == 0) return false;
    if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $Email)) return true;
    return false;
}
function check_input($input) {
    if (!preg_match("/(.*)[^a-zA-Z0-9àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸĐ\s._,-](.*)/", $input)) return true;
    return false;
}
 